// import _ from 'underscore'

/**
 * 路由配置
 * @type {Object}
 */
const routesConfig = {

  system: '系统管理',
  admin: '管理员管理',
  adminList: '管理员列表',
  adminNew: '新增管理员',
  adminEdit: {
    name: '管理员详情',
    paramName: 'id'
  },
  role: '角色管理',
  roleList: '角色列表',
  roleNew: '新增角色',
  roleEdit: {
    name: '角色详情',
    paramName: 'id'
  },
  permission: {
    name: '平台权限配置',
    paramName: 'id'
  },
  appPermission: {
    name: '小程序权限配置',
    paramName: 'id'
  },
  goodsList: '商品列表',
  goodsInfo: {
    name: '商品详情',
    paramName: 'id'
  },
  studioLevelList: '影楼等级管理',
  studioLevelInfo: {
    name: '影楼会员等级详情',
    paramName: 'id'
  },
  attributeList: '商品特性管理',
  attributeInfo: {
    name: '商品特性详情',
    paramName: 'id'
  },
  studioList: '影楼管理',
  studioInfo: {
    name: '影楼详情',
    paramName: 'id'
  },
  factoryList: '工厂管理',
  factoryInfo: {
    name: '工厂详情',
    paramName: 'id'
  },
  studioUserList: '影楼用户管理',
  studioUserInfo: {
    name: '影楼用户详情',
    paramName: 'id'
  },
  factoryUserList: '工厂用户管理',
  factoryUserInfo: {
    name: '工厂用户详情',
    paramName: 'id'
  },
  orderList: '订单管理',
  orderInfo: {
    name: '订单详情',
    paramName: 'id'
  },
  categoryList: '分类管理',
  categoryInfo: {
    name: '分类详情',
    paramName: 'id'
  },
  /**
   * 获取路由
   * @param  {String | Object} key   路由键
   * @param  {*} param 参数
   * @param  {String | Array} breadcrumb 自定义面包屑
   * @return {Object}       路由数据对象
   */
  getRoute (key, param, breadcrumb) {
    var result = {}
    if (key instanceof Object) {
      result.name = key.name
      result.params = {}
      if (param) {
        result.params[key.paramName] = param
      }
      if (breadcrumb) {
        result.params.bread_crumb = breadcrumb
      }
    } else {
      result.name = key
    }
    return result
  },
  /**
   * 获取带query参数的路由
   * @param  {String | Object} key   路由键
   * @param  {Object} query 参数
   * @param  {String | Array} breadcrumb 自定义面包屑
   * @return {Object}       路由数据对象
   */
  getRouteWithQuery (key, query, breadcrumb) {
    var result = {}
    if (key instanceof Object) {
      result.name = key.name
    } else {
      result.name = key
    }
    result.query = query
    if (breadcrumb) {
      result.params = {}
      result.params.bread_tail = breadcrumb
    }
    return result
  }
}

export default routesConfig
